/// FileName: common_button
/// Author: admin
/// Date: 2021-07-20 14:04
/// Description: 一个普通的按钮

import 'package:flutter/material.dart';

import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:high_help_apps/common/values/colors.dart';
import 'package:high_help_apps/common/values/radii.dart';
import 'package:high_help_apps/common/values/values.dart';

/// 普通按钮, 自带水波纹效果
class CommonButton extends StatelessWidget {
  CommonButton(
      {this.width,
      this.height,
      this.borderRadius,
      this.backgroundColor,
      required this.child,
      required this.onPressed,
      this.border,
      this.padding});

  final double? width;
  final double? height;

  final double? borderRadius;

  final Color? backgroundColor;
  final Border? border;
  final EdgeInsetsGeometry? padding;

  final Widget child;

  final vfunc onPressed;

  @override
  Widget build(BuildContext context) {
    return Padding(
      padding: padding ?? EdgeInsets.all(0),
      child: Material(
        color: Colors.transparent,
        child: Ink(
          decoration: BoxDecoration(
              color: backgroundColor,
              borderRadius:
                  BorderRadius.all(Radius.circular(borderRadius ?? 15.r)),
              border: border),
          child: InkWell(
            onTap: onPressed,
            borderRadius:
                BorderRadius.all(Radius.circular(borderRadius ?? 15.r)),
            child: Container(
              width: width ?? double.infinity,
              height: height ?? 45.r,
              child: child,
            ),
          ),
        ),
      ),
    );
  }
}
